from django_redis import get_redis_connection
class MyRedis:
    def __init__(self):
        self.conn = get_redis_connection('default')
    def setstr(self,key,value):
        self.conn.set(key,value)
    def setex(self,key,value,ex):
        self.conn.setex(key,value,ex)
    def getstr(self,key):
        val = self.conn.get(key)
        if val:
            return val.decode('utf-8')
        else:
            return None
redistoll = MyRedis()